Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports DotNetNuke
Namespace NVPortal.Modules.NVNews

    Public MustInherit Class Viewer
        Inherits Entities.Modules.PortalModuleBase

#Region "Event Handlers"
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Try
                'If Not IsPostBack Then
                If Request.Item("sch") <> "" Then
                    'load search control
                    'Response.Write("test")
                    Dim o_control As UserControl
                    o_control = CType(Page.LoadControl("~/DesktopModules/NV_News/Display/News/Detail/Search/Main.ascx"), UserControl)
                    Me.plhNews.Controls.Add(o_control)
                Else
                    If Request.Item("tin") = "" And Request.Item("danhmuc") = "" Then
                        'load newstop usercontrol
                        Dim o_control As UserControl
                        o_control = CType(Page.LoadControl("~/DesktopModules/NV_News/Display/News/Detail/DetailCat.ascx"), UserControl)
                        Me.plhNews.Controls.Add(o_control)
                    End If
                    If Request.Item("tin") <> "" Then
                        Dim o_control As UserControl
                        o_control = CType(Page.LoadControl("~/DesktopModules/NV_News/Display/News/Detail/Detail.ascx"), UserControl)
                        Me.plhNews.Controls.Add(o_control)
                    Else
                        If Request.Item("danhmuc") <> "" Then
                            Dim o_control As UserControl
                            '' xac dinh lai danhmuc de kiem tra xem co chua thu muc con khong
                            'Dim ctlCategory As New NV_NewsCategoriesController
                            'If ctlCategory.GetByParentId(Request.Item("danhmuc"), PortalId).Count > 0 Then
                            '    o_control = CType(Page.LoadControl("~/DesktopModules/NVNews/Display/News/newstop.ascx"), UserControl)
                            'Else
                            o_control = CType(Page.LoadControl("~/DesktopModules/NV_News/Display/News/Detail/DetailCat.ascx"), UserControl)
                            'End If

                            Me.plhNews.Controls.Add(o_control)
                        End If
                    End If
                End If
            Catch ex As Exception
                ProcessModuleLoadException(Me, ex)
            End Try
        End Sub
#End Region
    End Class

End Namespace
